perm filename GRAPH.2[QLA,LSP] blob sn#757069 filedate 1984-05-29 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	 Routines to plot performance of the multiprocessor
C00006 00003
C00010 ENDMK
CāŠ—;
;;; Routines to plot performance of the multiprocessor

(eval-when (load) 
	   (fasload ddmid fas dsk (sys rod)))
(declare (special *chan* *points* *best* *scale*)
	 (setq defmacro-for-compiling ())
	 (mapex t)
	 (*expr ddinit screen erase line dpyup gddchn rddchn))

(setq *scale* 1.0)

(defmacro tick (x y)
	  `(progn
	    (line ,x (+$ 1.0 yeps) ,x 1.0)
	    (line (+$ 1.0 xeps) ,y 1.0 ,y)))

(defun m-init-graph (&optional (points *points*) (best (float (cadar points))))
       (declare (flonum fhx fhy xeps yeps))
       (cond ((null points)
	      (terpri)
	      (princ "Not enough points")
	      (terpri))
	     (t (let ((fhx 0.0)(fhy 0.0) (xeps 0.0) (yeps 0.0))
		     (setq fhx (+$ 1.0 (float (length points))))
		     (setq fhy fhx)
		     (setq *best* best)
		     (setq xeps (//$ fhx 100.0))
		     (setq yeps (//$ fhy 100.0))
		     (setq *chan*
			   (gddchn -1))
		     (ddinit)
		     (screen 0.5 0.5 (*$ (float *scale*) fhx) 
			     (*$ (float *scale*) fhy))
		     (erase *chan*)
		     (line 1.0 1.0 1.0 fhy)
		     (line 1.0 1.0 fhx 1.0)
		     (let ((ox (float (caar points)))
			   (oy 1.0))
			  (do ((p (cdr points) (cdr p))
			       (nx 0.0)(ny 0.0))
			      ((null p) (tick nx nx) (dpyup *chan*))
			      (tick nx nx)
			      (setq nx (float (caar p)))
			      (setq ny (//$ best (float (cadar p))))
			      (line ox oy nx ny)
			      (setq ox nx oy ny)))))))

(defun m-add-graph (&optional (points *points*)
			      (best (float (cadar points))))
       (declare (fixnum hx hy)(flonum fhx fhy))
       (setq *best* best)
       (cond ((null points)
	      (terpri)
	      (princ "Not enough points")
	      (terpri))
	     (t (let ((ox (float (caar points)))
		      (oy (//$ *best* (float (cadar points)))))
		     (do ((p (cdr points) (cdr p))
			  (nx 0.0)(ny 0.0))
			 ((null p) (dpyup *chan*))
			 (setq nx (float (caar p)))
			 (setq ny (//$ *best* (float (cadar p))))
			 (line ox oy nx ny)
			 (setq ox nx oy ny)))) ))

(defun m-uninit ()
       (erase *chan*)
       (rddchn *chan*))

(defun m-reference (&optional (points *points*))
       (let ((n 0.0))
	    (m-add-graph
	     (mapcar #'(lambda (())
			       `(,(setq n (+$ 1.0 n))  
				 ,(//$ *best* n)))
		     points))))


(defmacro tick2 (x)
	  `(progn
	    (line ,x yeps ,x 0.0)))

(defun m-init-ggraph (&optional (points *points*) (high-x 0) (high-y 0))
       (declare (fixnum hx hy)(flonum fhx fhy xeps yeps))
       (cond ((null points)
	      (terpri)
	      (princ "Not enough points")
	      (terpri))
	     (t (let ((hx 0)
		      (hy 0)(xeps 0.0)(yeps 0.0)
		      (fhx 0.0)(fhy 0.0))
		     (mapc #'(lambda (x)
				     (cond ((< hx (car x))
					    (setq hx (car x))))
				     (cond ((< hy (cadr x))
					    (setq hy (cadr x)))))
			   points)
		     (setq fhx (*$ 1.1 (float (max high-x hx)))
			   fhy (*$ 1.1 (float (max high-y hy))))
		     (setq xeps (//$ fhx 100.0))
		     (setq yeps (//$ fhy 100.0))
		     (setq *chan*
			   (gddchn -1))
		     (ddinit)
		     (screen 0.0 0.0 (*$ (float *scale*) fhx) 
			     (*$ (float *scale*) fhy))
		     (erase *chan*)
		     (line 0.0 0.0 0.0 fhy)
		     (line 0.0 0.0 fhx 0.0)
		     (let ((ox (float (caar points)))
			   (oy (float (cadar points))))
			  (tick2 ox)
			  (do ((p (cdr points) (cdr p))
			       (nx 0.0)(ny 0.0))
			      ((null p) (tick2 nx)(dpyup *chan*))
			      (tick2 nx)
			      (setq nx (float (caar p)))
			      (setq ny (float (cadar p)))
			      (line ox oy nx ny)
			      (setq ox nx oy ny)))))))

(defun m-add-ggraph (&optional (points *points*))
       (declare (fixnum hx hy)(flonum fhx fhy))
       (cond ((null points)
	      (terpri)
	      (princ "Not enough points")
	      (terpri))
	     (t (let ((ox (float (caar points)))
		      (oy (float (cadar points))))
		     (do ((p (cdr points) (cdr p))
			  (nx 0.0)(ny 0.0))
			 ((null p) (dpyup *chan*))
			 (setq nx (float (caar p)))
			 (setq ny (float (cadar p)))
			 (line ox oy nx ny)
			 (setq ox nx oy ny)))))) 

(defun m-greference (&optional (points *points*))
       (let ((high (float (cadr (car points))))
	     (n 0.0))
	    (m-add-ggraph
	     (mapcar #'(lambda (x)
			       (setq n (+$ 1.0 n))
			       `(,(car x)
				 ,(//$ high
				       n)))
		     points))))